<template lang="">
  <div>
    <el-table
      :data="tableData"
      border
      :header-cell-style="{'text-align':'center',background:'#F2F2F2'}"
      :cell-style="{'text-align':'center'}">
      <el-table-column
        prop="userId"
        label="编号">
      </el-table-column>
      <el-table-column
        prop="goodsId"
        label="商品id">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建时间">
      </el-table-column>
      <el-table-column
        prop="updateTime"
        label="修改时间">
      </el-table-column>
      <el-table-column
        prop="serviceConsultant"
        label="服务顾问">
      </el-table-column>
      <el-table-column
        prop="goodsName"
        label="竞品名称">
      </el-table-column>
      <el-table-column
        label="服务顾问">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" style="color:#d7000f" size="small">小叶</el-button>
        </template>
      </el-table-column>
      <el-table-column
        label="操作">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="danger" size="small">删除</el-button>
          <el-button @click="handleClick(scope.row)" type="danger" plain size="small">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="5"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total" style="margin-top: 20px;">
    </el-pagination>
  </div>
</template>
<script>
export default {
  data () {
    return {
      currentPage4: 1, // 分页显示第几页
      pageRequest: { // 分页请求参数
        pageSize: 5, // 每页条数
        pageNum: 1 // 每页数量
      },
      total: 0, // 分页总条数
      tableData: []
    }
  },
  mounted () {
    this.selectByid()
  },
  methods: {
    selectByid () {
      this.$axios.get('/myAttention/findAllbyuserId', {
        params: {
          userId: 1
        }
      }).then(res => {
        if (res.data.flag) {
          this.tableData = res.data.obj
        } else {
          alert('失败')
        }
      })
    },
    handleClick (row) { // table表格中操作方法
      console.log(row)
    },
    handleSizeChange (val) { // 改变每页条数
      this.pageRequest.pageSize = val
    },
    handleCurrentChange (val) { // 改变当前页
      this.pageRequest.pageNum = val
    },
    myMessage (type, message) {
      this.$message({
        message: message,
        type: type
      })
    }
  }
}
</script>
<style lang="less" scoped>
  /deep/.el-menu-item.is-active {
    color: #FF6633;
    font-size: 24px;
    background-color: pink;
  }
  .two_my_bidding_content{
    margin-left: 10px;
    width: 99%;
  }
  .two_my_bidding_title{
    line-height: 100px;
    width: 100%;
    height: 100px;
  }
</style>
